import React, {Component} from "react";
import {View, Text, Button} from 'react-native';
import {observer, inject} from 'mobx-react';

import http from '../../utils/http'
import {getOrderBasicData} from '../../api/user'

@inject('test')
@observer
export default class Login extends Component {
  constructor(props) {
    super(props)

    this.state = {
      store: {}
    }
  }

  componentDidMount() {
    this.setState({
      store: this.props.test
    }, () => {
      this.state.store.fetchTodos()
      console.log(this.state.store);
    })

    getOrderBasicData().then(res => {
      console.log(123321, res);
    })
  }

  handleBtn = () => {
    this.state.store.fetchTodoAdd()
  }

  render() {
    return (
      <View>
        <Text>Login{ this.state.store.total}</Text>

        <Button title='点击' onPress={this.handleBtn}/>
      </View>
    )
  }
}
